using UnityEngine;
using UnityEngine.SceneManagement;

public class GameManager : SingletonMono<GameManager>, ISaveManager
{
    public BackpackMgr BackpackMgr;
    protected override void Awake()
    {
        base.Awake();
        BackpackMgr = BackpackMgr.Instance;

    }


    public void LoadScene(string _sceneName)
    {
        AsyncOperation ao = SceneManager.LoadSceneAsync(_sceneName);
        ao.completed += (ao) =>
        {
            int index = Random.Range(1, AudioManager.Instance.musics.Length);
            AudioManager.Instance.PlayMusic(index);
        };
        
    }


    public void LoadData(GameData _gameData)
    {

    }


    public void SaveData(ref GameData _gameData)
    {
    }

    public void PauseGame(bool pause)
    {
        if (pause)
        {
            Time.timeScale = 0;
        }
        else
        { 
            Time.timeScale = 1; 
        }
    }
}
